class TransactorsController < ApplicationController
  # GET /transactors
  # GET /transactors.xml
  
  before_filter :login_required
  before_filter :session_expiry
  
  def index
    @transactors = Transactor.all

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @transactors }
    end
  end

  # GET /transactors/1
  # GET /transactors/1.xml
  def show
    @transactor = Transactor.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @transactor }
    end
  end

  # GET /transactors/new
  # GET /transactors/new.xml
  def new
    @transactor = Transactor.new

    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @transactor }
    end
  end

  # GET /transactors/1/edit
  def edit
    @transactor = Transactor.find(params[:id])
  end

  # POST /transactors
  # POST /transactors.xml
  def create
    @transactor = Transactor.new(params[:transactor])

    respond_to do |format|
      if @transactor.save
        flash[:notice] = 'Transactor was successfully created.'
        format.html { redirect_to(@transactor) }
        format.xml  { render :xml => @transactor, :status => :created, :location => @transactor }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @transactor.errors, :status => :unprocessable_entity }
      end
    end
  end

  # PUT /transactors/1
  # PUT /transactors/1.xml
  def update
    @transactor = Transactor.find(params[:id])

    respond_to do |format|
      if @transactor.update_attributes(params[:transactor])
        flash[:notice] = 'Transactor was successfully updated.'
        format.html { redirect_to(@transactor) }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @transactor.errors, :status => :unprocessable_entity }
      end
    end
  end

  # DELETE /transactors/1
  # DELETE /transactors/1.xml
  def destroy
    @transactor = Transactor.find(params[:id])
    @transactor.destroy

    respond_to do |format|
      format.html { redirect_to(transactors_url) }
      format.xml  { head :ok }
    end
  end
end
